<!DOCTYPE html>
<html lang="en-US">
    <head>
        <title>Template - Front-end module to the Template Toolkit - metacpan.org</title>
        <link rel="preload" as="fetch" href="https://metacpan.org/account/login_status" crossorigin="anonymous" />
        <link href="https://metacpan.org/_assets/b8ccceeed47a0652049703d99326a9cea4933443.css" rel="stylesheet" type="text/css">
        <script src="https://metacpan.org/_assets/6bfedafe2d7caa915b7d84f61b45936818e3242e.js" type="text/javascript" defer></script>
        <link rel="alternate" type="application/rss+xml" title="Recent CPAN Uploads of Template-Toolkit - MetaCPAN" href="https://metacpan.org/dist/Template-Toolkit/releases.rss" />
        <link rel="canonical" href="Template.html" />
        <meta name="description" content="Front-end module to the Template Toolkit" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
        <link rel="shortcut icon" href="https://metacpan.org/static/icons/favicon.ico">
        <link rel="apple-touch-icon" sizes="152x152" href="https://metacpan.org/static/icons/apple-touch-icon.png">
        <link rel="search" href="https://metacpan.org/static/opensearch.xml" type="application/opensearchdescription+xml" title="MetaCPAN">
        <script>
          (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
          (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
          })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

          (function(skey, ga_id){
            ga('create', ga_id, {
              siteSpeedSampleRate : 100,
              storage             : 'none',
              clientId            : localStorage.getItem(skey)
            });
            ga(function(tracker) {
              localStorage.setItem(skey, tracker.get('clientId'));
            });
            ga('send', 'pageview');
          })('ga:clientId', 'UA-27829474-1');
        </script>
<meta name="twitter:card"        content="summary" />
<meta name="twitter:url"         content="https://metacpan.org/pod/Template" />
<meta name="twitter:title"       content="Template" />
<meta name="twitter:description" content="Front-end module to the Template Toolkit" />
<meta name="twitter:site"        content="metacpan" />
    </head>
    <body>
        <nav class="navbar navbar-default" role="navigation">
            <div class="header-logo-large hidden-xs">
              <a href="https://metacpan.org/" tabindex="0">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#logo" />
                </svg>
              </a>
            </div>
            <div class="header-logo-icon visible-xs">
              <a href="https://metacpan.org/">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#dots" />
                </svg>
              </a>
            </div>
            <ul class="nav navbar-nav menu-items hidden-xs hidden-sm">
              <li><a href="https://metacpan.org/about">About</a></li>
              <li><a href="https://metacpan.org/about/sponsors">Sponsor</a></li>
              <li><a href="https://grep.metacpan.org/">grep::cpan</a></li>
              <li><a href="https://metacpan.org/recent">Recent</a></li>
              <li><a href="https://metacpan.org/about/faq">FAQ</a></li>
              <li><a href="https://metacpan.org/tools">Tools</a></li>
              <li><a href="https://fastapi.metacpan.org/">API</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <button type="button" class="searchbar-btn visible-xs visible-sm">
                    <i class="fa fa-search button-fa-icon"></i>
                </button>
                <form action="https://metacpan.org/search" class="searchbar-form visible-md visible-lg search-form form-horizontal">
                   <input type="hidden" name="size" id="metacpan_search-size" value="20">
                  <div class="form-group">
                      <div class="search-group">
                        <i class="fa fa-search"></i>
                        <input type="text" name="q" placeholder="Search the CPAN" size="41" autocorrect="off" autocapitalize="off" spellcheck="false" id="metacpan_search-input" class="form-control" value="">
                      </div>
                  </div>
                </form>
                    <li class="icon-slidepanel visible-xs visible-sm">
                      <button data-toggle="slidepanel" data-target=".slidepanel">
                        <span class="button-fa-icon">
                          <i class="fa fa-bars slidepanel-open"></i>
                          <i class="fa fa-times slidepanel-close"></i>
                        </span>
                      </button>
                    </li>
                <form action="https://metacpan.org/account/logout" method="POST" id="metacpan-logout"></form>
                <li class="dropdown logged_in" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon logged-in-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a href="https://metacpan.org/account/identities">Identities</a></li>
                        <li><a href="https://metacpan.org/account/profile">Profile</a></li>
                        <li><a href="https://metacpan.org/account/favorite/list">Favorites</a></li>
                        <li>
                            <a href="Template.html#" type="button" onclick="$('#metacpan-logout').submit(); return false">
                              Logout
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_out" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li>
                            <a href="https://metacpan.org/login/github">
                                <i class="fab fa-github fa-fw"></i>
                                GitHub
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/twitter">
                                <i class="fab fa-twitter fa-fw"></i>
                                Twitter
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/google">
                                <i class="fab fa-google fa-fw"></i>
                                Google
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_placeholder">
                    <button>
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                    </button>
                </li>
            </ul>
        </nav>
        <div class="page-content ">
          <!--
          <div class="top-notify-banner">
            <i class="fas fa-info-circle"></i>
          </div>
          -->
          <nav class="sidebar">
            <div class="slidepanel">
              <ul class="nav-list ">
    <li class="nav-header no-margin-top">
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The date that this version of Template-Toolkit was released.">
      <span class="relatize">16 Aug 2022 07:02:05 UTC</span>
    </li>
  <li>
    Distribution: <a href="https://metacpan.org/dist/Template-Toolkit">Template-Toolkit</a>
  </li>
  <li>
    Module version: 3.101
  </li>
  <li>
    <a data-keyboard-shortcut="g s" href="https://metacpan.org/dist/Template-Toolkit/source/lib/Template.pm">Source</a>
    (<a href="https://metacpan.org/dist/Template-Toolkit/source/lib/Template.pm?raw=1">raw</a>)
  </li>
  <li>
    <a data-keyboard-shortcut="g b" href="https://metacpan.org/dist/Template-Toolkit/source/lib">Browse</a>
    (<a href="https://metacpan.org/dist/Template-Toolkit/source/lib?raw=1">raw</a>)
  </li>
    <li>
      <a data-keyboard-shortcut="g c" href="https://metacpan.org/dist/Template-Toolkit/changes">Changes</a>
    </li>
    <li>
      <a rel="noopener nofollow" class="nopopup" href="http://www.template-toolkit.org">Homepage</a>
    </li>
    <li>
      <a class="nopopup" href="https://metacpan.org/dist/Template-Toolkit/contribute">How to Contribute</a>
    </li>
    <li>
        <a rel="noopener nofollow" data-keyboard-shortcut="g r" href="https://github.com/abw/Template2">Repository</a>
    </li>
    <li>
      <a rel="noopener nofollow" data-keyboard-shortcut="g i" href="https://github.com/abw/Template2/issues">Issues</a>
      (89)
    </li>
    <li>
      <a rel="noopener nofollow" href="http://matrix.cpantesters.org/?dist=Template-Toolkit+3.101" title="Matrix">Testers</a>
        <span title="(pass / fail / na)">(<a rel="noopener nofollow" href="https://www.cpantesters.org/distro/T/Template-Toolkit.html?oncpan=1&amp;distmat=1&amp;version=3.101&amp;grade=2" style="color: #090">3627</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/T/Template-Toolkit.html?oncpan=1&amp;distmat=1&amp;version=3.101&amp;grade=3" style="color: #900">38</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/T/Template-Toolkit.html?oncpan=1&amp;distmat=1&amp;version=3.101&amp;grade=4">0</a>)</span>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpants.cpanauthors.org/release/ABW/Template-Toolkit-3.101">Kwalitee</a>
    </li>
    <li>
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The # people with an indexing permission on Template-Toolkit who have released something to CPAN in the last 2 years (i.e. the # people likely able to release critical fixes in a timely manner)">
      Bus factor: 3
      </div>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpancover.com/latest/Template-Toolkit-3.101/index.html">% Coverage </a>
    </li>
    <li>
      License: perl_5
    </li>
    <li class="nav-header">Activity</li>
    <li>
<div class="activity-graph">
    <img src="https://metacpan.org/dist/Template-Toolkit/activity.svg?res=month" />
    <div class="comment">24 month</div>
</div>
    </li>
    <li class="nav-header">Tools</li>
    <li>
      <a itemprop="downloadUrl" href="https://cpan.metacpan.org/authors/id/A/AB/ABW/Template-Toolkit-3.101.tar.gz">
      Download (<span itemprop="fileSize">503.85KB</span>)</a>
    </li>
    <li>
      <a href="https://explorer.metacpan.org/?url=%2Fmodule%2FABW%2FTemplate-Toolkit-3.101%2Flib%2FTemplate.pm">
        MetaCPAN Explorer
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/Template-Toolkit/permissions">
        Permissions
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/Template-Toolkit/releases.rss">
        Subscribe to distribution
      </a>
    </li>
    <li>
      <button class="btn btn-link" data-toggle="modal" data-target="#metacpan_install-instructions-dialog">
        Install Instructions
      </button>
    </li>
    <li>
      <form action="https://metacpan.org/search">
        <input type="hidden" name="q" value="dist:Template-Toolkit">
        <input type="search" name="q" placeholder="Search distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
      </form>
    </li>
    <li>
      <form action="https://grep.metacpan.org/search">
        <input type="hidden" name="qd" value="Template-Toolkit">
        <input type="hidden" name="source" value="metacpan">
        <input type="search" name="q" placeholder="grep distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
     </form>
    </li>
    <li class="version-jump">
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/lib/Template.pm&#39;" class="form-control tool-bar-form">
  <option disabled selected>Jump to version</option>
<option
  disabled
  value="ABW/Template-Toolkit-3.101"
>3.101
  (ABW on 2022-08-16)</option>
<option
  
  value="TODDR/Template-Toolkit-3.100"
>3.100
  (TODDR on 2022-04-26)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.009"
>3.009
  (ATOOMIC on 2020-07-13)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.008"
>3.008
  (ATOOMIC on 2020-03-30)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.007"
>3.007
  (ATOOMIC on 2020-01-27)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.006"
>3.006
  (ATOOMIC on 2020-01-16)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.005"
>3.005
  (ATOOMIC on 2020-01-15)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.004"
>3.004
  (ATOOMIC on 2020-01-13)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.003"
>3.003
  (ATOOMIC on 2019-12-27)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.002"
>3.002
  (ATOOMIC on 2019-12-23)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.001"
>3.001
  (ATOOMIC on 2019-12-23)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.000"
>3.000
  (ATOOMIC on 2019-12-23)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-2.29"
>2.29
  (ATOOMIC on 2019-04-29)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-2.28"
>2.28
  (ATOOMIC on 2018-10-11)</option>
<option
  
  value="ABW/Template-Toolkit-2.27"
>2.27
  (ABW on 2017-04-15)</option>
<option
  
  value="ABW/Template-Toolkit-2.26"
>2.26
  (ABW on 2014-09-17)</option>
<option
  
  value="ABW/Template-Toolkit-2.25"
>2.25
  (ABW on 2013-07-24)</option>
<option
  
  value="ABW/Template-Toolkit-2.24"
>2.24
  (ABW on 2012-02-08)</option>
<option
  
  value="ABW/Template-Toolkit-2.23"
>2.23
  (ABW on 2012-01-21)</option>
<option
  
  value="ABW/Template-Toolkit-2.22"
>2.22
  (ABW on 2009-07-21)</option>
<option
  
  value="ABW/Template-Toolkit-2.21_02"
>2.21_02 DEV
  (ABW on 2009-07-04)</option>
<option
  
  value="ABW/Template-Toolkit-2.21_01"
>2.21_01 DEV
  (ABW on 2009-07-04)</option>
<option
  
  value="ABW/Template-Toolkit-2.21"
>2.21
  (ABW on 2009-06-30)</option>
<option
  
  value="ABW/Template-Toolkit-2.20_4"
>2.20_4 DEV
  (ABW on 2009-05-21)</option>
<option
  
  value="ABW/Template-Toolkit-2.20_3"
>2.20_3 DEV
  (ABW on 2009-05-20)</option>
<option
  
  value="ABW/Template-Toolkit-2.20_2"
>2.20_2 DEV
  (ABW on 2009-05-17)</option>
<option
  
  value="ABW/Template-Toolkit-2.20_1"
>2.20_1 DEV
  (ABW on 2009-04-07)</option>
<option
  
  value="ABW/Template-Toolkit-2.20"
>2.20
  (ABW on 2008-08-13)</option>
<option
  
  value="ABW/Template-Toolkit-2.00"
>2.00
  (ABW on 2000-12-06)</option>
<option
  
  value="ABW/Template-Toolkit-1.07"
>1.07
  (ABW on 2000-06-16)</option>
<optgroup label="BackPAN">'
<option
  
  value="ATOOMIC/Template-Toolkit-3.010"
>3.010
  (ATOOMIC on 2021-12-13)</option>
<option
  
  value="ABW/Template-Toolkit-2.19_03"
>2.19_03 DEV
  (ABW on 2008-08-12)</option>
<option
  
  value="ABW/Template-Toolkit-2.19_02"
>2.19_02 DEV
  (ABW on 2008-08-08)</option>
<option
  
  value="ABW/Template-Toolkit-2.19_01"
>2.19_01 DEV
  (ABW on 2008-08-07)</option>
<option
  
  value="ABW/Template-Toolkit-2.19"
>2.19
  (ABW on 2007-04-30)</option>
<option
  
  value="ABW/Template-Toolkit-2.18"
>2.18
  (ABW on 2007-02-09)</option>
<option
  
  value="ADAMK/Template-Toolkit-2.17"
>2.17
  (ADAMK on 2007-02-08)</option>
<option
  
  value="ADAMK/Template-Toolkit-2.16"
>2.16
  (ADAMK on 2007-01-23)</option>
<option
  
  value="ABW/Template-Toolkit-2.15"
>2.15
  (ABW on 2006-05-26)</option>
<option
  
  value="ABW/Template-Toolkit-2.14"
>2.14
  (ABW on 2004-10-04)</option>
<option
  
  value="ABW/Template-Toolkit-2.13"
>2.13
  (ABW on 2004-01-30)</option>
<option
  
  value="ABW/Template-Toolkit-2.12"
>2.12
  (ABW on 2004-01-12)</option>
<option
  
  value="ABW/Template-Toolkit-2.11"
>2.11
  (ABW on 2004-01-06)</option>
<option
  
  value="ABW/Template-Toolkit-2.10"
>2.10
  (ABW on 2003-07-24)</option>
<option
  
  value="ABW/Template-Toolkit-2.09"
>2.09
  (ABW on 2003-04-23)</option>
<option
  
  value="ABW/Template-Toolkit-2.08"
>2.08
  (ABW on 2002-07-30)</option>
<option
  
  value="ABW/Template-Toolkit-2.07"
>2.07
  (ABW on 2002-04-17)</option>
<option
  
  value="ABW/Template-Toolkit-2.06d"
>2.06d
  (ABW on 2002-01-22)</option>
<option
  
  value="ABW/Template-Toolkit-2.06"
>2.06
  (ABW on 2001-11-07)</option>
<option
  
  value="ABW/Template-Toolkit-2.04"
>2.04
  (ABW on 2001-06-29)</option>
<option
  
  value="ABW/Template-Toolkit-2.03"
>2.03
  (ABW on 2001-06-15)</option>
<option
  
  value="ABW/Template-Toolkit-2.01"
>2.01
  (ABW on 2001-03-30)</option>
<option
  
  value="ABW/Template-Toolkit-2.00-beta5"
>2.00-beta5
  (ABW on 2000-09-14)</option>
<option
  
  value="ABW/Template-Toolkit-2.00-beta4"
>2.00-beta4
  (ABW on 2000-09-12)</option>
<option
  
  value="ABW/Template-Toolkit-1.06"
>1.06
  (ABW on 2000-03-28)</option>
<option
  
  value="ABW/Template-Toolkit-1.05"
>1.05
  (ABW on 2000-03-20)</option>
<option
  
  value="ABW/Template-Toolkit-1.04"
>1.04
  (ABW on 2000-03-02)</option>
<option
  
  value="ABW/Template-Toolkit-1.03"
>1.03
  (ABW on 2000-02-01)</option>
<option
  
  value="ABW/Template-Toolkit-1.02"
>1.02
  (ABW on 1999-12-21)</option>
<option
  
  value="ABW/Template-Toolkit-1.00"
>1.00
  (ABW on 1999-12-02)</option>
<option
  
  value="ABW/Template-Toolkit-0.28"
>0.28
  (ABW on 1999-11-05)</option>
<option
  
  value="ABW/Template-Toolkit-0.27"
>0.27
  (ABW on 1999-10-01)</option>
<option
  
  value="ABW/Template-Toolkit-0.26"
>0.26
  (ABW on 1999-09-15)</option>
<option
  
  value="ABW/Template-Toolkit-0.25"
>0.25
  (ABW on 1999-08-16)</option>
<option
  
  value="ABW/Template-Toolkit-0.24"
>0.24
  (ABW on 1999-08-12)</option>
<option
  
  value="ABW/Template-Toolkit-0.23"
>0.23
  (ABW on 1999-08-10)</option>
<option
  
  value="ABW/Template-Toolkit-0.22"
>0.22
  (ABW on 1999-08-06)</option>
</optgroup>
</select>
    </li>
    <li class="version-diff">
<select onchange="document.location.href='/release/ABW/Template-Toolkit-3.101/diff/' + encodeURIComponent(this.value) + '/lib/Template.pm'
" class="form-control tool-bar-form">
  <option disabled selected>Diff with version</option>
<option
  disabled
  value="ABW/Template-Toolkit-3.101"
>3.101
  (ABW on 2022-08-16)</option>
<option
  
  value="TODDR/Template-Toolkit-3.100"
>3.100
  (TODDR on 2022-04-26)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.009"
>3.009
  (ATOOMIC on 2020-07-13)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.008"
>3.008
  (ATOOMIC on 2020-03-30)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.007"
>3.007
  (ATOOMIC on 2020-01-27)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.006"
>3.006
  (ATOOMIC on 2020-01-16)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.005"
>3.005
  (ATOOMIC on 2020-01-15)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.004"
>3.004
  (ATOOMIC on 2020-01-13)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.003"
>3.003
  (ATOOMIC on 2019-12-27)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.002"
>3.002
  (ATOOMIC on 2019-12-23)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.001"
>3.001
  (ATOOMIC on 2019-12-23)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.000"
>3.000
  (ATOOMIC on 2019-12-23)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-2.29"
>2.29
  (ATOOMIC on 2019-04-29)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-2.28"
>2.28
  (ATOOMIC on 2018-10-11)</option>
<option
  
  value="ABW/Template-Toolkit-2.27"
>2.27
  (ABW on 2017-04-15)</option>
<option
  
  value="ABW/Template-Toolkit-2.26"
>2.26
  (ABW on 2014-09-17)</option>
<option
  
  value="ABW/Template-Toolkit-2.25"
>2.25
  (ABW on 2013-07-24)</option>
<option
  
  value="ABW/Template-Toolkit-2.24"
>2.24
  (ABW on 2012-02-08)</option>
<option
  
  value="ABW/Template-Toolkit-2.23"
>2.23
  (ABW on 2012-01-21)</option>
<option
  
  value="ABW/Template-Toolkit-2.22"
>2.22
  (ABW on 2009-07-21)</option>
<option
  
  value="ABW/Template-Toolkit-2.21_02"
>2.21_02 DEV
  (ABW on 2009-07-04)</option>
<option
  
  value="ABW/Template-Toolkit-2.21_01"
>2.21_01 DEV
  (ABW on 2009-07-04)</option>
<option
  
  value="ABW/Template-Toolkit-2.21"
>2.21
  (ABW on 2009-06-30)</option>
<option
  
  value="ABW/Template-Toolkit-2.20_4"
>2.20_4 DEV
  (ABW on 2009-05-21)</option>
<option
  
  value="ABW/Template-Toolkit-2.20_3"
>2.20_3 DEV
  (ABW on 2009-05-20)</option>
<option
  
  value="ABW/Template-Toolkit-2.20_2"
>2.20_2 DEV
  (ABW on 2009-05-17)</option>
<option
  
  value="ABW/Template-Toolkit-2.20_1"
>2.20_1 DEV
  (ABW on 2009-04-07)</option>
<option
  
  value="ABW/Template-Toolkit-2.20"
>2.20
  (ABW on 2008-08-13)</option>
<option
  
  value="ABW/Template-Toolkit-2.00"
>2.00
  (ABW on 2000-12-06)</option>
<option
  
  value="ABW/Template-Toolkit-1.07"
>1.07
  (ABW on 2000-06-16)</option>
<optgroup label="BackPAN">'
<option
  
  value="ATOOMIC/Template-Toolkit-3.010"
>3.010
  (ATOOMIC on 2021-12-13)</option>
<option
  
  value="ABW/Template-Toolkit-2.19_03"
>2.19_03 DEV
  (ABW on 2008-08-12)</option>
<option
  
  value="ABW/Template-Toolkit-2.19_02"
>2.19_02 DEV
  (ABW on 2008-08-08)</option>
<option
  
  value="ABW/Template-Toolkit-2.19_01"
>2.19_01 DEV
  (ABW on 2008-08-07)</option>
<option
  
  value="ABW/Template-Toolkit-2.19"
>2.19
  (ABW on 2007-04-30)</option>
<option
  
  value="ABW/Template-Toolkit-2.18"
>2.18
  (ABW on 2007-02-09)</option>
<option
  
  value="ADAMK/Template-Toolkit-2.17"
>2.17
  (ADAMK on 2007-02-08)</option>
<option
  
  value="ADAMK/Template-Toolkit-2.16"
>2.16
  (ADAMK on 2007-01-23)</option>
<option
  
  value="ABW/Template-Toolkit-2.15"
>2.15
  (ABW on 2006-05-26)</option>
<option
  
  value="ABW/Template-Toolkit-2.14"
>2.14
  (ABW on 2004-10-04)</option>
<option
  
  value="ABW/Template-Toolkit-2.13"
>2.13
  (ABW on 2004-01-30)</option>
<option
  
  value="ABW/Template-Toolkit-2.12"
>2.12
  (ABW on 2004-01-12)</option>
<option
  
  value="ABW/Template-Toolkit-2.11"
>2.11
  (ABW on 2004-01-06)</option>
<option
  
  value="ABW/Template-Toolkit-2.10"
>2.10
  (ABW on 2003-07-24)</option>
<option
  
  value="ABW/Template-Toolkit-2.09"
>2.09
  (ABW on 2003-04-23)</option>
<option
  
  value="ABW/Template-Toolkit-2.08"
>2.08
  (ABW on 2002-07-30)</option>
<option
  
  value="ABW/Template-Toolkit-2.07"
>2.07
  (ABW on 2002-04-17)</option>
<option
  
  value="ABW/Template-Toolkit-2.06d"
>2.06d
  (ABW on 2002-01-22)</option>
<option
  
  value="ABW/Template-Toolkit-2.06"
>2.06
  (ABW on 2001-11-07)</option>
<option
  
  value="ABW/Template-Toolkit-2.04"
>2.04
  (ABW on 2001-06-29)</option>
<option
  
  value="ABW/Template-Toolkit-2.03"
>2.03
  (ABW on 2001-06-15)</option>
<option
  
  value="ABW/Template-Toolkit-2.01"
>2.01
  (ABW on 2001-03-30)</option>
<option
  
  value="ABW/Template-Toolkit-2.00-beta5"
>2.00-beta5
  (ABW on 2000-09-14)</option>
<option
  
  value="ABW/Template-Toolkit-2.00-beta4"
>2.00-beta4
  (ABW on 2000-09-12)</option>
<option
  
  value="ABW/Template-Toolkit-1.06"
>1.06
  (ABW on 2000-03-28)</option>
<option
  
  value="ABW/Template-Toolkit-1.05"
>1.05
  (ABW on 2000-03-20)</option>
<option
  
  value="ABW/Template-Toolkit-1.04"
>1.04
  (ABW on 2000-03-02)</option>
<option
  
  value="ABW/Template-Toolkit-1.03"
>1.03
  (ABW on 2000-02-01)</option>
<option
  
  value="ABW/Template-Toolkit-1.02"
>1.02
  (ABW on 1999-12-21)</option>
<option
  
  value="ABW/Template-Toolkit-1.00"
>1.00
  (ABW on 1999-12-02)</option>
<option
  
  value="ABW/Template-Toolkit-0.28"
>0.28
  (ABW on 1999-11-05)</option>
<option
  
  value="ABW/Template-Toolkit-0.27"
>0.27
  (ABW on 1999-10-01)</option>
<option
  
  value="ABW/Template-Toolkit-0.26"
>0.26
  (ABW on 1999-09-15)</option>
<option
  
  value="ABW/Template-Toolkit-0.25"
>0.25
  (ABW on 1999-08-16)</option>
<option
  
  value="ABW/Template-Toolkit-0.24"
>0.24
  (ABW on 1999-08-12)</option>
<option
  
  value="ABW/Template-Toolkit-0.23"
>0.23
  (ABW on 1999-08-10)</option>
<option
  
  value="ABW/Template-Toolkit-0.22"
>0.22
  (ABW on 1999-08-06)</option>
</optgroup>
</select>
    </li>

    <li>
<ul class="dependencies">
  <li class="nav-header">Dependencies</li>
  <li><i class="ttip" title="dynamic_config enabled">unknown</i></li>
  <li>
    <hr>
  </li>
  <li>
    <a href="https://metacpan.org/module/Template/requires">Reverse dependencies</a>
  </li>
  <li>
    <a href="http://deps.cpantesters.org/?module=Template">CPAN Testers List</a>
  </li>
  <li>
    <a href="https://cpandeps.grinnz.com/?dist=Template-Toolkit">Dependency graph</a>
  </li>
</ul>
    </li>
    <li class="nav-header">Permalinks</li>
    <li>
      <a href="https://metacpan.org/release/ABW/Template-Toolkit-3.101/view/lib/Template.pm">This version</a>
    </li>
    <li>
      <a href="Template.html">Latest version</a>
    </li>
    <li>
<div class="plussers">
<div class="nav-header">++ed by:</div>
<div>
<a class="display-all" href="https://metacpan.org/author/NOBUNAGA"><img src="https://www.gravatar.com/avatar/e772b59ce63734ea31a70ae3463607d1?d=identicon&amp;s=20" title="NOBUNAGA" alt="NOBUNAGA"></a>
<a class="display-all" href="https://metacpan.org/author/HERNAN"><img src="https://www.gravatar.com/avatar/4692a7e916ce61f3d05846d7fe89c4f0?d=identicon&amp;s=20" title="HERNAN" alt="HERNAN"></a>
<a class="display-all" href="https://metacpan.org/author/KEEDI"><img src="https://www.gravatar.com/avatar/95f905a7a4ccc573c711e9d264c0fde8?d=identicon&amp;s=20" title="KEEDI" alt="KEEDI"></a>
<a class="display-all" href="https://metacpan.org/author/NEBULOUS"><img src="https://www.gravatar.com/avatar/aa104029af7659a73c2a611b6db18786?d=identicon&amp;s=20" title="NEBULOUS" alt="NEBULOUS"></a>
<a class="display-all" href="https://metacpan.org/author/KARJALA"><img src="https://www.gravatar.com/avatar/9685932c4be47d9e6370f49230700c40?d=identicon&amp;s=20" title="KARJALA" alt="KARJALA"></a>
</div>
<!-- Display counts of plussers-->
<div>
    <a href="https://metacpan.org/dist/Template-Toolkit/plussers">74 PAUSE users</a>
</div>
<div>
    70 non-PAUSE users
</div>
</div>
    </li>
    <li>
<div id="metacpan_contributors">
  <div>
    <button class="btn-link"
      onclick="$(this).hide(); $('#metacpan_contributors ul').slideDown(); return false;"
    >and 1 contributors</button>
  </div>
  <ul style="display: none">
    <li class="contributor"
      data-contrib-email="abw@wardley.org"
    >
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=identicon&amp;s=20" />
      Andy Wardley
    </li>
  </ul>
</div>
    </li>
              </ul>
            </div>
          </nav>
          <div class="content-navigation">
<div class="breadcrumbs">
  <span>
    <a data-keyboard-shortcut="g a" rel="author" href="https://metacpan.org/author/ABW" class="author-name">Andy Wardley</a>
  </span>
  <span>&nbsp;/&nbsp;</span>
  <div class="release dist-release status-latest maturity-released">
    <span class="dropdown"><b class="caret"></b></span>
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/lib/Template.pm&#39;" class="">
<option
  selected
  value="ABW/Template-Toolkit-3.101"
>3.101
  (ABW on 2022-08-16)</option>
<option
  
  value="TODDR/Template-Toolkit-3.100"
>3.100
  (TODDR on 2022-04-26)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.009"
>3.009
  (ATOOMIC on 2020-07-13)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.008"
>3.008
  (ATOOMIC on 2020-03-30)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.007"
>3.007
  (ATOOMIC on 2020-01-27)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.006"
>3.006
  (ATOOMIC on 2020-01-16)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.005"
>3.005
  (ATOOMIC on 2020-01-15)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.004"
>3.004
  (ATOOMIC on 2020-01-13)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.003"
>3.003
  (ATOOMIC on 2019-12-27)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.002"
>3.002
  (ATOOMIC on 2019-12-23)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.001"
>3.001
  (ATOOMIC on 2019-12-23)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-3.000"
>3.000
  (ATOOMIC on 2019-12-23)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-2.29"
>2.29
  (ATOOMIC on 2019-04-29)</option>
<option
  
  value="ATOOMIC/Template-Toolkit-2.28"
>2.28
  (ATOOMIC on 2018-10-11)</option>
<option
  
  value="ABW/Template-Toolkit-2.27"
>2.27
  (ABW on 2017-04-15)</option>
<option
  
  value="ABW/Template-Toolkit-2.26"
>2.26
  (ABW on 2014-09-17)</option>
<option
  
  value="ABW/Template-Toolkit-2.25"
>2.25
  (ABW on 2013-07-24)</option>
<option
  
  value="ABW/Template-Toolkit-2.24"
>2.24
  (ABW on 2012-02-08)</option>
<option
  
  value="ABW/Template-Toolkit-2.23"
>2.23
  (ABW on 2012-01-21)</option>
<option
  
  value="ABW/Template-Toolkit-2.22"
>2.22
  (ABW on 2009-07-21)</option>
<option
  
  value="ABW/Template-Toolkit-2.21_02"
>2.21_02 DEV
  (ABW on 2009-07-04)</option>
<option
  
  value="ABW/Template-Toolkit-2.21_01"
>2.21_01 DEV
  (ABW on 2009-07-04)</option>
<option
  
  value="ABW/Template-Toolkit-2.21"
>2.21
  (ABW on 2009-06-30)</option>
<option
  
  value="ABW/Template-Toolkit-2.20_4"
>2.20_4 DEV
  (ABW on 2009-05-21)</option>
<option
  
  value="ABW/Template-Toolkit-2.20_3"
>2.20_3 DEV
  (ABW on 2009-05-20)</option>
<option
  
  value="ABW/Template-Toolkit-2.20_2"
>2.20_2 DEV
  (ABW on 2009-05-17)</option>
<option
  
  value="ABW/Template-Toolkit-2.20_1"
>2.20_1 DEV
  (ABW on 2009-04-07)</option>
<option
  
  value="ABW/Template-Toolkit-2.20"
>2.20
  (ABW on 2008-08-13)</option>
<option
  
  value="ABW/Template-Toolkit-2.00"
>2.00
  (ABW on 2000-12-06)</option>
<option
  
  value="ABW/Template-Toolkit-1.07"
>1.07
  (ABW on 2000-06-16)</option>
<optgroup label="BackPAN">'
<option
  
  value="ATOOMIC/Template-Toolkit-3.010"
>3.010
  (ATOOMIC on 2021-12-13)</option>
<option
  
  value="ABW/Template-Toolkit-2.19_03"
>2.19_03 DEV
  (ABW on 2008-08-12)</option>
<option
  
  value="ABW/Template-Toolkit-2.19_02"
>2.19_02 DEV
  (ABW on 2008-08-08)</option>
<option
  
  value="ABW/Template-Toolkit-2.19_01"
>2.19_01 DEV
  (ABW on 2008-08-07)</option>
<option
  
  value="ABW/Template-Toolkit-2.19"
>2.19
  (ABW on 2007-04-30)</option>
<option
  
  value="ABW/Template-Toolkit-2.18"
>2.18
  (ABW on 2007-02-09)</option>
<option
  
  value="ADAMK/Template-Toolkit-2.17"
>2.17
  (ADAMK on 2007-02-08)</option>
<option
  
  value="ADAMK/Template-Toolkit-2.16"
>2.16
  (ADAMK on 2007-01-23)</option>
<option
  
  value="ABW/Template-Toolkit-2.15"
>2.15
  (ABW on 2006-05-26)</option>
<option
  
  value="ABW/Template-Toolkit-2.14"
>2.14
  (ABW on 2004-10-04)</option>
<option
  
  value="ABW/Template-Toolkit-2.13"
>2.13
  (ABW on 2004-01-30)</option>
<option
  
  value="ABW/Template-Toolkit-2.12"
>2.12
  (ABW on 2004-01-12)</option>
<option
  
  value="ABW/Template-Toolkit-2.11"
>2.11
  (ABW on 2004-01-06)</option>
<option
  
  value="ABW/Template-Toolkit-2.10"
>2.10
  (ABW on 2003-07-24)</option>
<option
  
  value="ABW/Template-Toolkit-2.09"
>2.09
  (ABW on 2003-04-23)</option>
<option
  
  value="ABW/Template-Toolkit-2.08"
>2.08
  (ABW on 2002-07-30)</option>
<option
  
  value="ABW/Template-Toolkit-2.07"
>2.07
  (ABW on 2002-04-17)</option>
<option
  
  value="ABW/Template-Toolkit-2.06d"
>2.06d
  (ABW on 2002-01-22)</option>
<option
  
  value="ABW/Template-Toolkit-2.06"
>2.06
  (ABW on 2001-11-07)</option>
<option
  
  value="ABW/Template-Toolkit-2.04"
>2.04
  (ABW on 2001-06-29)</option>
<option
  
  value="ABW/Template-Toolkit-2.03"
>2.03
  (ABW on 2001-06-15)</option>
<option
  
  value="ABW/Template-Toolkit-2.01"
>2.01
  (ABW on 2001-03-30)</option>
<option
  
  value="ABW/Template-Toolkit-2.00-beta5"
>2.00-beta5
  (ABW on 2000-09-14)</option>
<option
  
  value="ABW/Template-Toolkit-2.00-beta4"
>2.00-beta4
  (ABW on 2000-09-12)</option>
<option
  
  value="ABW/Template-Toolkit-1.06"
>1.06
  (ABW on 2000-03-28)</option>
<option
  
  value="ABW/Template-Toolkit-1.05"
>1.05
  (ABW on 2000-03-20)</option>
<option
  
  value="ABW/Template-Toolkit-1.04"
>1.04
  (ABW on 2000-03-02)</option>
<option
  
  value="ABW/Template-Toolkit-1.03"
>1.03
  (ABW on 2000-02-01)</option>
<option
  
  value="ABW/Template-Toolkit-1.02"
>1.02
  (ABW on 1999-12-21)</option>
<option
  
  value="ABW/Template-Toolkit-1.00"
>1.00
  (ABW on 1999-12-02)</option>
<option
  
  value="ABW/Template-Toolkit-0.28"
>0.28
  (ABW on 1999-11-05)</option>
<option
  
  value="ABW/Template-Toolkit-0.27"
>0.27
  (ABW on 1999-10-01)</option>
<option
  
  value="ABW/Template-Toolkit-0.26"
>0.26
  (ABW on 1999-09-15)</option>
<option
  
  value="ABW/Template-Toolkit-0.25"
>0.25
  (ABW on 1999-08-16)</option>
<option
  
  value="ABW/Template-Toolkit-0.24"
>0.24
  (ABW on 1999-08-12)</option>
<option
  
  value="ABW/Template-Toolkit-0.23"
>0.23
  (ABW on 1999-08-10)</option>
<option
  
  value="ABW/Template-Toolkit-0.22"
>0.22
  (ABW on 1999-08-06)</option>
</optgroup>
</select>
    <a data-keyboard-shortcut="g d" class="release-name" href="https://metacpan.org/dist/Template-Toolkit">Template-Toolkit-3.101</a>
  </div>
<span class="river-gauge-gauge">
  <svg width="24px"
       height="15px"
       version="1.1"
       xmlns="http://www.w3.org/2000/svg"
       xmlns:xlink="http://www.w3.org/1999/xlink">

    <g>
      <title>        River stage three &#10;
          • 561 direct dependents &#10;          • 959 total dependents
      </title>

      <rect x="0"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="5"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="10"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="15"  y="0" width="4" height="15" fill="#e4e2e2" />
      <rect x="20"  y="0" width="4" height="15" fill="#e4e2e2" />
    </g>
  </svg>

</span>
<div id="Template-Toolkit-fav" class="logged_in">
<form action="https://metacpan.org/account/favorite/add" style="display: inline" onsubmit="return favDistribution(this)">
    <input type="hidden" name="remove" value="0">
    <input type="hidden" name="release" value="Template-Toolkit-3.101">
    <input type="hidden" name="author" value="ABW">
    <input type="hidden" name="distribution" value="Template-Toolkit">
    <button type="submit" class="favorite highlight"><span>144</span> ++</button>
</form>
</div>
<div class="logged_out">
<a href="Template.html" onclick="alert('Please sign in to add favorites'); return false" class="favorite highlight">
<span>144</span> ++</a>
</div>
   / <span>Template</span>
</div>
          </div>
          <main class="content">


<nav class="toc">
  <div class="toc-header"><strong>Contents</strong></div>
<ul>
  <li><a href="Template.html#NAME">NAME</a></li>
  <li><a href="Template.html#SYNOPSIS">SYNOPSIS</a></li>
  <li><a href="Template.html#DESCRIPTION">DESCRIPTION</a></li>
  <li><a href="Template.html#METHODS">METHODS</a>
    <ul>
      <li><a href="Template.html#new(%5C%25config)">new(\%config)</a></li>
      <li><a href="Template.html#process($template,-%5C%25vars,-$output,-%25options)">process($template, \%vars, $output, %options)</a></li>
      <li><a href="Template.html#error()">error()</a></li>
      <li><a href="Template.html#service()">service()</a></li>
      <li><a href="Template.html#context()">context()</a></li>
      <li><a href="Template.html#template($name)">template($name)</a></li>
    </ul>
  </li>
  <li><a href="Template.html#CONFIGURATION-SUMMARY">CONFIGURATION SUMMARY</a>
    <ul>
      <li><a href="Template.html#Template-Style-and-Parsing-Options">Template Style and Parsing Options</a>
        <ul>
          <li><a href="Template.html#ENCODING">ENCODING</a></li>
          <li><a href="Template.html#START_TAG,-END_TAG">START_TAG, END_TAG</a></li>
          <li><a href="Template.html#TAG_STYLE">TAG_STYLE</a></li>
          <li><a href="Template.html#PRE_CHOMP,-POST_CHOMP">PRE_CHOMP, POST_CHOMP</a></li>
          <li><a href="Template.html#TRIM">TRIM</a></li>
          <li><a href="Template.html#INTERPOLATE">INTERPOLATE</a></li>
          <li><a href="Template.html#ANYCASE">ANYCASE</a></li>
        </ul>
      </li>
      <li><a href="Template.html#Template-Files-and-Blocks">Template Files and Blocks</a>
        <ul>
          <li><a href="Template.html#INCLUDE_PATH">INCLUDE_PATH</a></li>
          <li><a href="Template.html#DELIMITER">DELIMITER</a></li>
          <li><a href="Template.html#ABSOLUTE">ABSOLUTE</a></li>
          <li><a href="Template.html#RELATIVE">RELATIVE</a></li>
          <li><a href="Template.html#DEFAULT">DEFAULT</a></li>
          <li><a href="Template.html#BLOCKS">BLOCKS</a></li>
          <li><a href="Template.html#AUTO_RESET">AUTO_RESET</a></li>
          <li><a href="Template.html#RECURSION">RECURSION</a></li>
        </ul>
      </li>
      <li><a href="Template.html#Template-Variables">Template Variables</a>
        <ul>
          <li><a href="Template.html#VARIABLES">VARIABLES</a></li>
        </ul>
      </li>
      <li><a href="Template.html#Runtime-Processing-Options">Runtime Processing Options</a>
        <ul>
          <li><a href="Template.html#EVAL_PERL">EVAL_PERL</a></li>
          <li><a href="Template.html#PRE_PROCESS,-POST_PROCESS">PRE_PROCESS, POST_PROCESS</a></li>
          <li><a href="Template.html#PROCESS">PROCESS</a></li>
          <li><a href="Template.html#ERROR">ERROR</a></li>
          <li><a href="Template.html#OUTPUT">OUTPUT</a></li>
          <li><a href="Template.html#OUTPUT_PATH">OUTPUT_PATH</a></li>
          <li><a href="Template.html#DEBUG">DEBUG</a></li>
        </ul>
      </li>
      <li><a href="Template.html#Caching-and-Compiling-Options">Caching and Compiling Options</a>
        <ul>
          <li><a href="Template.html#CACHE_SIZE">CACHE_SIZE</a></li>
          <li><a href="Template.html#COMPILE_EXT">COMPILE_EXT</a></li>
          <li><a href="Template.html#COMPILE_DIR">COMPILE_DIR</a></li>
        </ul>
      </li>
      <li><a href="Template.html#Plugins-and-Filters">Plugins and Filters</a>
        <ul>
          <li><a href="Template.html#PLUGINS">PLUGINS</a></li>
          <li><a href="Template.html#PLUGIN_BASE">PLUGIN_BASE</a></li>
          <li><a href="Template.html#LOAD_PERL">LOAD_PERL</a></li>
          <li><a href="Template.html#FILTERS">FILTERS</a></li>
        </ul>
      </li>
      <li><a href="Template.html#Customisation-and-Extension">Customisation and Extension</a>
        <ul>
          <li><a href="Template.html#LOAD_TEMPLATES">LOAD_TEMPLATES</a></li>
          <li><a href="Template.html#LOAD_PLUGINS">LOAD_PLUGINS</a></li>
          <li><a href="Template.html#LOAD_FILTERS">LOAD_FILTERS</a></li>
          <li><a href="Template.html#TOLERANT">TOLERANT</a></li>
          <li><a href="Template.html#SERVICE">SERVICE</a></li>
          <li><a href="Template.html#CONTEXT">CONTEXT</a></li>
          <li><a href="Template.html#STASH">STASH</a></li>
          <li><a href="Template.html#PARSER">PARSER</a></li>
          <li><a href="Template.html#GRAMMAR">GRAMMAR</a></li>
        </ul>
      </li>
    </ul>
  </li>
  <li><a href="Template.html#DIRECTIVE-SUMMARY">DIRECTIVE SUMMARY</a>
    <ul>
      <li><a href="Template.html#GET">GET</a></li>
      <li><a href="Template.html#CALL">CALL</a></li>
      <li><a href="Template.html#SET">SET</a></li>
      <li><a href="Template.html#DEFAULT1">DEFAULT</a></li>
      <li><a href="Template.html#INSERT">INSERT</a></li>
      <li><a href="Template.html#PROCESS1">PROCESS</a></li>
      <li><a href="Template.html#INCLUDE">INCLUDE</a></li>
      <li><a href="Template.html#WRAPPER">WRAPPER</a></li>
      <li><a href="Template.html#BLOCK">BLOCK</a></li>
      <li><a href="Template.html#FOREACH">FOREACH</a></li>
      <li><a href="Template.html#WHILE">WHILE</a></li>
      <li><a href="Template.html#IF-/-UNLESS-/-ELSIF-/-ELSE">IF / UNLESS / ELSIF / ELSE</a></li>
      <li><a href="Template.html#SWITCH-/-CASE">SWITCH / CASE</a></li>
      <li><a href="Template.html#MACRO">MACRO</a></li>
      <li><a href="Template.html#FILTER">FILTER</a></li>
      <li><a href="Template.html#USE">USE</a></li>
      <li><a href="Template.html#PERL-/-RAWPERL">PERL / RAWPERL</a></li>
      <li><a href="Template.html#TRY-/-THROW-/-CATCH-/-FINAL">TRY / THROW / CATCH / FINAL</a></li>
      <li><a href="Template.html#NEXT">NEXT</a></li>
      <li><a href="Template.html#LAST">LAST</a></li>
      <li><a href="Template.html#RETURN">RETURN</a></li>
      <li><a href="Template.html#STOP">STOP</a></li>
      <li><a href="Template.html#TAGS">TAGS</a></li>
      <li><a href="Template.html#COMMENTS">COMMENTS</a></li>
    </ul>
  </li>
  <li><a href="Template.html#SOURCE-CODE-REPOSITORY">SOURCE CODE REPOSITORY</a></li>
  <li><a href="Template.html#AUTHOR">AUTHOR</a></li>
  <li><a href="Template.html#VERSION">VERSION</a></li>
  <li><a href="Template.html#SUPPORT">SUPPORT</a></li>
  <li><a href="Template.html#COPYRIGHT">COPYRIGHT</a></li>
</ul></nav>
<div class="pod anchors">
<h1 id="NAME">NAME</h1>

<p>Template - Front-end module to the Template Toolkit</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<pre><code>    use Template;

    # some useful options (see below for full list)
    my $config = {
        INCLUDE_PATH =&gt; &#39;/search/path&#39;,  # or list ref
        INTERPOLATE  =&gt; 1,               # expand &quot;$var&quot; in plain text
        POST_CHOMP   =&gt; 1,               # cleanup whitespace
        PRE_PROCESS  =&gt; &#39;header&#39;,        # prefix each template
        EVAL_PERL    =&gt; 1,               # evaluate Perl code blocks
    };

    # create Template object
    my $template = Template-&gt;new($config);

    # define template variables for replacement
    my $vars = {
        var1  =&gt; $value,
        var2  =&gt; \%hash,
        var3  =&gt; \@list,
        var4  =&gt; \&amp;code,
        var5  =&gt; $object,
    };

    # specify input filename, or file handle, text reference, etc.
    my $input = &#39;myfile.html&#39;;

    # process input template, substituting variables
    $template-&gt;process($input, $vars)
        || die $template-&gt;error();</code></pre>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p>This documentation describes the Template module which is the direct Perl interface into the Template Toolkit. It covers the use of the module and gives a brief summary of configuration options and template directives. Please see <a href="https://metacpan.org/pod/distribution/Template-Toolkit/lib/Template/Manual.pod">Template::Manual</a> for the complete reference manual which goes into much greater depth about the features and use of the Template Toolkit. The <a href="https://metacpan.org/pod/distribution/Template-Toolkit/lib/Template/Tutorial.pod">Template::Tutorial</a> is also available as an introductory guide to using the Template Toolkit.</p>

<h1 id="METHODS">METHODS</h1>

<h2 id="new(\%config)"><a id="new"></a><a id="new-config"></a>new(\%config)</h2>

<p>The <code>new()</code> constructor method (implemented by the <a href="https://metacpan.org/pod/Template::Base#new()">Template::Base</a> base class) instantiates a new <code>Template</code> object. A reference to a hash array of configuration items may be passed as a parameter.</p>

<pre><code>    my $tt = Template-&gt;new({
        INCLUDE_PATH =&gt; &#39;/usr/local/templates&#39;,
        EVAL_PERL    =&gt; 1,
    }) || die $Template::ERROR, &quot;\n&quot;;</code></pre>

<p>A reference to a new <code>Template</code> object is returned, or undef on error. In the latter case, the error message can be retrieved by calling <a href="https://metacpan.org/pod/error()">error()</a> as a class method or by examining the <code>$Template::ERROR</code> package variable directly.</p>

<pre><code>    my $tt = Template-&gt;new(\%config)
        || die Template-&gt;error(), &quot;\n&quot;;

    my $tt = Template-&gt;new(\%config)
        || die $Template::ERROR, &quot;\n&quot;;</code></pre>

<p>For convenience, configuration items may also be specified as a list of items instead of a hash array reference. These are automatically folded into a hash array by the constructor.</p>

<pre><code>    my $tt = Template-&gt;new(INCLUDE_PATH =&gt; &#39;/tmp&#39;, POST_CHOMP =&gt; 1)
        || die $Template::ERROR, &quot;\n&quot;;</code></pre>

<h2 id="process($template,-\%vars,-$output,-%options)"><a id="process"></a><a id="process-template---vars---output---options"></a>process($template, \%vars, $output, %options)</h2>

<p>The <code>process()</code> method is called to process a template. The first parameter indicates the input template as one of:</p>

<ul>

<li><p>a filename relative to <code>INCLUDE_PATH</code>, if defined</p>

</li>
<li><p>a reference to a text string containing the template text</p>

</li>
<li><p>a file handle reference (e.g. <code>IO::Handle</code> or sub-class) or <code>GLOB</code> (e.g. <code>\*STDIN</code>), from which the template can be read.</p>

</li>
</ul>

<p>A reference to a hash array may be passed as the second parameter, containing definitions of template variables.</p>

<pre><code>    # filename
    $tt-&gt;process(&#39;welcome.tt2&#39;)
        || die $tt-&gt;error(), &quot;\n&quot;;

    # text reference
    $text = &quot;[% INCLUDE header %]\nHello world!\n[% INCLUDE footer %]&quot;;
    $tt-&gt;process(\$text)
        || die $tt-&gt;error(), &quot;\n&quot;;

    # file handle (GLOB)
    $tt-&gt;process(\*DATA)
        || die $tt-&gt;error(), &quot;\n&quot;;

    __END__
    [% INCLUDE header %]
    This is a template defined in the __END__ section which is
    accessible via the DATA &quot;file handle&quot;.
    [% INCLUDE footer %]</code></pre>

<p>By default, the processed template output is printed to <code>STDOUT</code>. The <code>process()</code> method then returns <code>1</code> to indicate success. A third parameter may be passed to the <code>process()</code> method to specify a different output location. This value may be one of:</p>

<ul>

<li><p>a plain string indicating a filename which will be opened (relative to <code>OUTPUT_PATH</code>, if defined) and the output written to</p>

</li>
<li><p>a file GLOB opened ready for output</p>

</li>
<li><p>a reference to a scalar (e.g. a text string) to which output/error is appended</p>

</li>
<li><p>a reference to a subroutine which is called, passing the output as a parameter</p>

</li>
<li><p>any object reference which implements a <code>print()</code> method (e.g. <code>IO::Handle</code>, <code>Apache::Request</code>, etc.) which will be called, passing the generated output as a parameter.</p>

</li>
</ul>

<p>Examples:</p>

<pre><code>    # output filename
    $tt-&gt;process(&#39;welcome.tt2&#39;, $vars, &#39;welcome.html&#39;)
        || die $tt-&gt;error(), &quot;\n&quot;;

    # reference to output subroutine
    sub myout {
        my $output = shift;
        ...
    }
    $tt-&gt;process(&#39;welcome.tt2&#39;, $vars, \&amp;myout)
        || die $tt-&gt;error(), &quot;\n&quot;;

    # reference to output text string
    my $output = &#39;&#39;;
    $tt-&gt;process(&#39;welcome.tt2&#39;, $vars, \$output)
        || die $tt-&gt;error(), &quot;\n&quot;;

    print &quot;output: $output\n&quot;;</code></pre>

<p>In an Apache/mod_perl handler:</p>

<pre><code>    sub handler {
        my $req = shift;

        # ...your code here...

        # direct output to Apache::Request via $req-&gt;print($output)
        $tt-&gt;process($file, $vars, $req) || do {
            $req-&gt;log_reason($tt-&gt;error());
            return SERVER_ERROR;
        };
        return OK;
    }</code></pre>

<p>After the optional third output argument can come an optional reference to a hash or a list of <code>(name, value)</code> pairs providing further options for the output. The only option currently supported is <code>binmode</code> which, when set to any true value will ensure that files created (but not any existing file handles passed) will be set to binary mode.</p>

<pre><code>    # either: hash reference of options
    $tt-&gt;process($infile, $vars, $outfile, { binmode =&gt; 1 })
        || die $tt-&gt;error(), &quot;\n&quot;;

    # or: list of name, value pairs
    $tt-&gt;process($infile, $vars, $outfile, binmode =&gt; 1)
        || die $tt-&gt;error(), &quot;\n&quot;;</code></pre>

<p>Alternately, the <code>binmode</code> argument can specify a particular IO layer such as <code>:utf8</code>.</p>

<pre><code>    $tt-&gt;process($infile, $vars, $outfile, binmode =&gt; &#39;:utf8&#39;)
        || die $tt-&gt;error(), &quot;\n&quot;;</code></pre>

<p>The <code>OUTPUT</code> configuration item can be used to specify a default output location other than <code>\*STDOUT</code>. The <code>OUTPUT_PATH</code> specifies a directory which should be prefixed to all output locations specified as filenames.</p>

<pre><code>    my $tt = Template-&gt;new({
        OUTPUT      =&gt; sub { ... },       # default
        OUTPUT_PATH =&gt; &#39;/tmp&#39;,
    ...
    }) || die Template-&gt;error(), &quot;\n&quot;;

    # use default OUTPUT (sub is called)
    $tt-&gt;process(&#39;welcome.tt2&#39;, $vars)
        || die $tt-&gt;error(), &quot;\n&quot;;

    # write file to &#39;/tmp/welcome.html&#39;
    $tt-&gt;process(&#39;welcome.tt2&#39;, $vars, &#39;welcome.html&#39;)
        || die $tt-&gt;error(), &quot;\n&quot;;</code></pre>

<p>The <code>process()</code> method returns <code>1</code> on success or <code>undef</code> on error. The error message generated in the latter case can be retrieved by calling the <a href="https://metacpan.org/pod/error()">error()</a> method. See also <a href="Template.html#CONFIGURATION-SUMMARY">&quot;CONFIGURATION SUMMARY&quot;</a> which describes how error handling may be further customised.</p>

<h2 id="error()"><a id="error"></a>error()</h2>

<p>When called as a class method, it returns the value of the <code>$ERROR</code> package variable. Thus, the following are equivalent.</p>

<pre><code>    my $tt = Template-&gt;new()
        || die Template-&gt;error(), &quot;\n&quot;;

    my $tt = Template-&gt;new()
        || die $Template::ERROR, &quot;\n&quot;;</code></pre>

<p>When called as an object method, it returns the value of the internal <code>_ERROR</code> variable, as set by an error condition in a previous call to process().</p>

<pre><code>    $tt-&gt;process(&#39;welcome.tt2&#39;)
        || die $tt-&gt;error(), &quot;\n&quot;;</code></pre>

<p>Errors are represented in the Template Toolkit by objects of the <a href="https://metacpan.org/pod/Template::Exception">Template::Exception</a> class. If the <a href="https://metacpan.org/pod/process()">process()</a> method returns a false value then the <code>error()</code> method can be called to return an object of this class. The <a href="https://metacpan.org/pod/Template::Exception#type()">type()</a> and <a href="https://metacpan.org/pod/Template::Exception#info()">info()</a> methods can called on the object to retrieve the error type and information string, respectively. The <a href="https://metacpan.org/pod/Template::Exception#as_string()">as_string()</a> method can be called to return a string of the form <code>$type - $info</code>. This method is also overloaded onto the stringification operator allowing the object reference itself to be printed to return the formatted error string.</p>

<pre><code>    $tt-&gt;process(&#39;somefile&#39;) || do {
        my $error = $tt-&gt;error();
        print &quot;error type: &quot;, $error-&gt;type(), &quot;\n&quot;;
        print &quot;error info: &quot;, $error-&gt;info(), &quot;\n&quot;;
        print $error, &quot;\n&quot;;
    };</code></pre>

<h2 id="service()"><a id="service"></a>service()</h2>

<p>The <code>Template</code> module delegates most of the effort of processing templates to an underlying <a href="https://metacpan.org/pod/Template::Service">Template::Service</a> object. This method returns a reference to that object.</p>

<h2 id="context()"><a id="context"></a>context()</h2>

<p>The <a href="https://metacpan.org/pod/Template::Service">Template::Service</a> module uses a core <a href="https://metacpan.org/pod/Template::Context">Template::Context</a> object for runtime processing of templates. This method returns a reference to that object and is equivalent to <code>$template-&gt;service-&gt;context()</code>.</p>

<h2 id="template($name)"><a id="template"></a><a id="template-name"></a>template($name)</h2>

<p>This method is a simple wrapper around the <a href="https://metacpan.org/pod/Template::Context">Template::Context</a> method of the same name. It returns a compiled template for the source provided as an argument.</p>

<h1 id="CONFIGURATION-SUMMARY"><a id="CONFIGURATION"></a>CONFIGURATION SUMMARY</h1>

<p>The following list gives a short summary of each Template Toolkit configuration option. See <a href="https://metacpan.org/pod/distribution/Template-Toolkit/lib/Template/Manual/Config.pod">Template::Manual::Config</a> for full details.</p>

<h2 id="Template-Style-and-Parsing-Options"><a id="Template"></a>Template Style and Parsing Options</h2>

<h3 id="ENCODING">ENCODING</h3>

<p>Specifies the character encoding.</p>

<h3 id="START_TAG,-END_TAG"><a id="START_TAG"></a><a id="START_TAG--END_TAG"></a>START_TAG, END_TAG</h3>

<p>Define tokens that indicate start and end of directives (default: &#39;<code>[%</code>&#39; and &#39;<code>%]</code>&#39;).</p>

<h3 id="TAG_STYLE">TAG_STYLE</h3>

<p>Set <code>START_TAG</code> and <code>END_TAG</code> according to a pre-defined style (default: &#39;<code>template</code>&#39;, as above).</p>

<h3 id="PRE_CHOMP,-POST_CHOMP"><a id="PRE_CHOMP"></a><a id="PRE_CHOMP--POST_CHOMP"></a>PRE_CHOMP, POST_CHOMP</h3>

<p>Removes whitespace before/after directives (default: 0/0).</p>

<h3 id="TRIM">TRIM</h3>

<p>Remove leading and trailing whitespace from template output (default: 0).</p>

<h3 id="INTERPOLATE">INTERPOLATE</h3>

<p>Interpolate variables embedded like <code>$this</code> or <code>${this}</code> (default: 0).</p>

<h3 id="ANYCASE">ANYCASE</h3>

<p>Allow directive keywords in lower case (default: 0 - UPPER only).</p>

<h2 id="Template-Files-and-Blocks"><a id="Template1"></a>Template Files and Blocks</h2>

<h3 id="INCLUDE_PATH">INCLUDE_PATH</h3>

<p>One or more directories to search for templates.</p>

<h3 id="DELIMITER">DELIMITER</h3>

<p>Delimiter for separating paths in <code>INCLUDE_PATH</code> (default: &#39;<code>:</code>&#39;).</p>

<h3 id="ABSOLUTE">ABSOLUTE</h3>

<p>Allow absolute file names, e.g. <code>/foo/bar.html</code> (default: 0).</p>

<h3 id="RELATIVE">RELATIVE</h3>

<p>Allow relative filenames, e.g. <code>../foo/bar.html</code> (default: 0).</p>

<h3 id="DEFAULT">DEFAULT</h3>

<p>Default template to use when another not found.</p>

<h3 id="BLOCKS">BLOCKS</h3>

<p>Hash array pre-defining template blocks.</p>

<h3 id="AUTO_RESET">AUTO_RESET</h3>

<p>Enabled by default causing <code>BLOCK</code> definitions to be reset each time a template is processed. Disable to allow <code>BLOCK</code> definitions to persist.</p>

<h3 id="RECURSION">RECURSION</h3>

<p>Flag to permit recursion into templates (default: 0).</p>

<h2 id="Template-Variables"><a id="Template2"></a>Template Variables</h2>

<h3 id="VARIABLES">VARIABLES</h3>

<p>Hash array of variables and values to pre-define in the stash.</p>

<h2 id="Runtime-Processing-Options"><a id="Runtime"></a>Runtime Processing Options</h2>

<h3 id="EVAL_PERL">EVAL_PERL</h3>

<p>Flag to indicate if <code>PERL</code>/<code>RAWPERL</code> blocks should be processed (default: 0).</p>

<h3 id="PRE_PROCESS,-POST_PROCESS"><a id="PRE_PROCESS"></a><a id="PRE_PROCESS--POST_PROCESS"></a>PRE_PROCESS, POST_PROCESS</h3>

<p>Name of template(s) to process before/after main template.</p>

<h3 id="PROCESS">PROCESS</h3>

<p>Name of template(s) to process instead of main template.</p>

<h3 id="ERROR">ERROR</h3>

<p>Name of error template or reference to hash array mapping error types to templates.</p>

<h3 id="OUTPUT">OUTPUT</h3>

<p>Default output location or handler.</p>

<h3 id="OUTPUT_PATH">OUTPUT_PATH</h3>

<p>Directory into which output files can be written.</p>

<h3 id="DEBUG">DEBUG</h3>

<p>Enable debugging messages.</p>

<h2 id="Caching-and-Compiling-Options"><a id="Caching"></a>Caching and Compiling Options</h2>

<h3 id="CACHE_SIZE">CACHE_SIZE</h3>

<p>Maximum number of compiled templates to cache in memory (default: undef - cache all)</p>

<h3 id="COMPILE_EXT">COMPILE_EXT</h3>

<p>Filename extension for compiled template files (default: undef - don&#39;t compile).</p>

<h3 id="COMPILE_DIR">COMPILE_DIR</h3>

<p>Root of directory in which compiled template files should be written (default: undef - don&#39;t compile).</p>

<h2 id="Plugins-and-Filters"><a id="Plugins"></a>Plugins and Filters</h2>

<h3 id="PLUGINS">PLUGINS</h3>

<p>Reference to a hash array mapping plugin names to Perl packages.</p>

<h3 id="PLUGIN_BASE">PLUGIN_BASE</h3>

<p>One or more base classes under which plugins may be found.</p>

<h3 id="LOAD_PERL">LOAD_PERL</h3>

<p>Flag to indicate regular Perl modules should be loaded if a named plugin can&#39;t be found (default: 0).</p>

<h3 id="FILTERS">FILTERS</h3>

<p>Hash array mapping filter names to filter subroutines or factories.</p>

<h2 id="Customisation-and-Extension"><a id="Customisation"></a>Customisation and Extension</h2>

<h3 id="LOAD_TEMPLATES">LOAD_TEMPLATES</h3>

<p>List of template providers.</p>

<h3 id="LOAD_PLUGINS">LOAD_PLUGINS</h3>

<p>List of plugin providers.</p>

<h3 id="LOAD_FILTERS">LOAD_FILTERS</h3>

<p>List of filter providers.</p>

<h3 id="TOLERANT">TOLERANT</h3>

<p>Set providers to tolerate errors as declinations (default: 0).</p>

<h3 id="SERVICE">SERVICE</h3>

<p>Reference to a custom service object (default: <a href="https://metacpan.org/pod/Template::Service">Template::Service</a>).</p>

<h3 id="CONTEXT">CONTEXT</h3>

<p>Reference to a custom context object (default: <a href="https://metacpan.org/pod/Template::Context">Template::Context</a>).</p>

<h3 id="STASH">STASH</h3>

<p>Reference to a custom stash object (default: <a href="https://metacpan.org/pod/Template::Stash">Template::Stash</a>).</p>

<h3 id="PARSER">PARSER</h3>

<p>Reference to a custom parser object (default: <a href="https://metacpan.org/pod/Template::Parser">Template::Parser</a>).</p>

<h3 id="GRAMMAR">GRAMMAR</h3>

<p>Reference to a custom grammar object (default: <a href="https://metacpan.org/pod/Template::Grammar">Template::Grammar</a>).</p>

<h1 id="DIRECTIVE-SUMMARY"><a id="DIRECTIVE"></a>DIRECTIVE SUMMARY</h1>

<p>The following list gives a short summary of each Template Toolkit directive. See <a href="https://metacpan.org/pod/distribution/Template-Toolkit/lib/Template/Manual/Directives.pod">Template::Manual::Directives</a> for full details.</p>

<h2 id="GET">GET</h2>

<p>Evaluate and print a variable or value.</p>

<pre><code>    [%   GET variable %]    # &#39;GET&#39; keyword is optional
    [%       variable %]
    [%       hash.key %]
    [%         list.n %]
    [%     code(args) %]
    [% obj.meth(args) %]
    [%  &quot;value: $var&quot; %]</code></pre>

<h2 id="CALL">CALL</h2>

<p>As per <a href="https://metacpan.org/pod/GET">GET</a> but without printing result (e.g. call code)</p>

<pre><code>    [%  CALL variable %]</code></pre>

<h2 id="SET">SET</h2>

<p>Assign a values to variables.</p>

<pre><code>    [% SET variable = value %]    # &#39;SET&#39; also optional
    [%     variable = other_variable
           variable = &#39;literal text @ $100&#39;
           variable = &quot;interpolated text: $var&quot;
           list     = [ val, val, val, val, ... ]
           list     = [ val..val ]
           hash     = { var =&gt; val, var =&gt; val, ... }
    %]</code></pre>

<h2 id="DEFAULT1">DEFAULT</h2>

<p>Like <a href="https://metacpan.org/pod/SET">SET</a>, but variables are only set if currently unset (i.e. have no true value).</p>

<pre><code>    [% DEFAULT variable = value %]</code></pre>

<h2 id="INSERT">INSERT</h2>

<p>Insert a file without any processing performed on the contents.</p>

<pre><code>    [% INSERT legalese.txt %]</code></pre>

<h2 id="PROCESS1">PROCESS</h2>

<p>Process another template file or block and insert the generated output. Any template <a href="https://metacpan.org/pod/BLOCK">BLOCK</a>s or variables defined or updated in the <code>PROCESS</code>ed template will thereafter be defined in the calling template.</p>

<pre><code>    [% PROCESS template %]
    [% PROCESS template  var = val, ... %]</code></pre>

<h2 id="INCLUDE">INCLUDE</h2>

<p>Similar to <code>PROCESS</code>, but using a local copy of the current variables. Any template <code>BLOCK</code>s or variables defined in the <code>INCLUDE</code>d template remain local to it.</p>

<pre><code>    [% INCLUDE template %]
    [% INCLUDE template  var = val, ... %]</code></pre>

<h2 id="WRAPPER">WRAPPER</h2>

<p>The content between the <code>WRAPPER</code> and corresponding <code>END</code> directives is first evaluated, with the output generated being stored in the <code>content</code> variable. The named template is then process as per <code>INCLUDE</code>.</p>

<pre><code>    [% WRAPPER layout %]
       Some template markup [% blah %]...
    [% END %]</code></pre>

<p>A simple <i>layout</i> template might look something like this:</p>

<pre><code>    Your header here...
    [% content %]
    Your footer here...</code></pre>

<h2 id="BLOCK">BLOCK</h2>

<p>Define a named template block for <a href="https://metacpan.org/pod/INCLUDE">INCLUDE</a>, <a href="https://metacpan.org/pod/PROCESS">PROCESS</a> and <a href="https://metacpan.org/pod/WRAPPER">WRAPPER</a> to use.</p>

<pre><code>    [% BLOCK hello %]
       Hello World
    [% END %]

    [% INCLUDE hello %]</code></pre>

<h2 id="FOREACH">FOREACH</h2>

<p>Repeat the enclosed <code>FOREACH</code> ... <code>END</code> block for each value in the list.</p>

<pre><code>    [% FOREACH variable IN [ val, val, val ] %]    # either
    [% FOREACH variable IN list %]                 # or
       The variable is set to [% variable %]
    [% END %]</code></pre>

<h2 id="WHILE">WHILE</h2>

<p>The block enclosed between <code>WHILE</code> and <code>END</code> block is processed while the specified condition is true.</p>

<pre><code>    [% WHILE condition %]
       content
    [% END %]</code></pre>

<h2 id="IF-/-UNLESS-/-ELSIF-/-ELSE"><a id="IF"></a><a id="IF---UNLESS---ELSIF---ELSE"></a>IF / UNLESS / ELSIF / ELSE</h2>

<p>The enclosed block is processed if the condition is true / false.</p>

<pre><code>    [% IF condition %]
       content
    [% ELSIF condition %]
     content
    [% ELSE %]
     content
    [% END %]

    [% UNLESS condition %]
       content
    [% # ELSIF/ELSE as per IF, above %]
       content
    [% END %]</code></pre>

<h2 id="SWITCH-/-CASE"><a id="SWITCH"></a><a id="SWITCH---CASE"></a>SWITCH / CASE</h2>

<p>Multi-way switch/case statement.</p>

<pre><code>    [% SWITCH variable %]
    [%   CASE val1 %]
           content
    [%   CASE [ val2, val3 ] %]
           content
    [%   CASE %]         # or [% CASE DEFAULT %]
           content
    [% END %]</code></pre>

<h2 id="MACRO">MACRO</h2>

<p>Define a named macro.</p>

<pre><code>    [% MACRO name &lt;directive&gt; %]
    [% MACRO name(arg1, arg2) &lt;directive&gt; %]
    ...
    [% name %]
    [% name(val1, val2) %]</code></pre>

<h2 id="FILTER">FILTER</h2>

<p>Process enclosed <code>FILTER</code> ... <code>END</code> block then pipe through a filter.</p>

<pre><code>    [% FILTER name %]                       # either
    [% FILTER name( params ) %]             # or
    [% FILTER alias = name( params ) %]     # or
       content
    [% END %]</code></pre>

<h2 id="USE">USE</h2>

<p>Load a plugin module (see <code>Template::&lt;Manual::Plugins</code>), or any regular Perl module when the <code>LOAD_PERL</code> option is set.</p>

<pre><code>    [% USE name %]                      # either
    [% USE name( params ) %]            # or
    [% USE var = name( params ) %]      # or
    ...
    [% name.method %]
    [% var.method %]</code></pre>

<h2 id="PERL-/-RAWPERL"><a id="PERL"></a><a id="PERL---RAWPERL"></a>PERL / RAWPERL</h2>

<p>Evaluate enclosed blocks as Perl code (requires the <code>EVAL_PERL</code> option to be set).</p>

<pre><code>    [% PERL %]
     # perl code goes here
     $stash-&gt;set(&#39;foo&#39;, 10);
     print &quot;set &#39;foo&#39; to &quot;, $stash-&gt;get(&#39;foo&#39;), &quot;\n&quot;;
     print $context-&gt;include(&#39;footer&#39;, { var =&gt; $val });
    [% END %]

    [% RAWPERL %]
       # raw perl code goes here, no magic but fast.
       $output .= &#39;some output&#39;;
    [% END %]</code></pre>

<h2 id="TRY-/-THROW-/-CATCH-/-FINAL"><a id="TRY"></a><a id="TRY---THROW---CATCH---FINAL"></a>TRY / THROW / CATCH / FINAL</h2>

<p>Exception handling.</p>

<pre><code>    [% TRY %]
     content
       [% THROW type info %]
    [% CATCH type %]
     catch content
       [% error.type %] [% error.info %]
    [% CATCH %] # or [% CATCH DEFAULT %]
     content
    [% FINAL %]
       this block is always processed
    [% END %]</code></pre>

<h2 id="NEXT">NEXT</h2>

<p>Jump straight to the next item in a <code>FOREACH</code> or <code>WHILE</code> loop.</p>

<pre><code>    [% NEXT %]</code></pre>

<h2 id="LAST">LAST</h2>

<p>Break out of <code>FOREACH</code> or <code>WHILE</code> loop.</p>

<pre><code>    [% LAST %]</code></pre>

<h2 id="RETURN">RETURN</h2>

<p>Stop processing current template and return to including templates.</p>

<pre><code>    [% RETURN %]</code></pre>

<h2 id="STOP">STOP</h2>

<p>Stop processing all templates and return to caller.</p>

<pre><code>    [% STOP %]</code></pre>

<h2 id="TAGS">TAGS</h2>

<p>Define new tag style or characters (default: <code>[%</code> <code>%]</code>).</p>

<pre><code>    [% TAGS html %]
    [% TAGS &lt;!-- --&gt; %]</code></pre>

<h2 id="COMMENTS">COMMENTS</h2>

<p>Ignored and deleted.</p>

<pre><code>    [% # this is a comment to the end of line
       foo = &#39;bar&#39;
    %]

    [%# placing the &#39;#&#39; immediately inside the directive
        tag comments out the entire directive
    %]</code></pre>

<h1 id="SOURCE-CODE-REPOSITORY"><a id="SOURCE"></a>SOURCE CODE REPOSITORY</h1>

<p>The source code for the Template Toolkit is held in a public git repository on Github: <a href="https://github.com/abw/Template2">https://github.com/abw/Template2</a></p>

<h1 id="AUTHOR">AUTHOR</h1>

<p>Andy Wardley &lt;abw@wardley.org&gt; <a href="http://wardley.org/">http://wardley.org/</a></p>

<h1 id="VERSION">VERSION</h1>

<p>Template Toolkit version 3.100, released on July 13 2020.</p>

<h1 id="SUPPORT">SUPPORT</h1>

<p>The Template Toolkit mailing list provides a forum for discussing issues relating to the use and abuse of the Template Toolkit. There are a number of knowledgeable and helpful individuals who frequent the list (including the author) who can often offer help or suggestions. Please respect their time and patience by checking the documentation and/or mailing list archives before asking questions that may already have been answered.</p>

<p>To subscribe to the mailing list, send an email to:</p>

<pre><code>    template-toolkit+subscribe@groups.io</code></pre>

<p>You can also use the web interface:</p>

<pre><code>    https://groups.io/g/template-toolkit</code></pre>

<p>For information about commercial support and consultancy for the Template Toolkit, please contact the author.</p>

<h1 id="COPYRIGHT">COPYRIGHT</h1>

<p>Copyright (C) 1996-2022 Andy Wardley. All Rights Reserved.</p>

<p>This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p></div>

<div id="metacpan_install-instructions-dialog" class="modal fade">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title">Module Install Instructions</h4>
      </div>
      <div class="modal-body">
        <p>To install Template::Toolkit, copy and paste the appropriate command in to your terminal.</p>
        <p><a href="https://metacpan.org/dist/App-cpanminus/view/bin/cpanm">cpanm</a></p>
        <pre><code>cpanm Template::Toolkit</code></pre>
        <p><a href="https://metacpan.org/pod/CPAN">CPAN shell</a></p>
        <pre><code>perl -MCPAN -e shell
install Template::Toolkit</code></pre>
        <p>For more information on module installation, please visit <a href="https://www.cpan.org/modules/INSTALL.html">the detailed CPAN module installation guide</a>.</p>
      </div>
      <div class="modal-footer">
        <a href="Template.html#" data-dismiss="modal" class="btn">Close</a>
      </div>
    </div>
  </div>
</div>
          </main>
          <div class="content-pagination">
          </div>
        </div>
        <footer class="footer">
          <div class="footer-container">
            <div class="footer-social">
              <div class="footer-link footer-logo">
                <a href="https://metacpan.org/">
                  <img src="https://metacpan.org/static/images/metacpan-logo.svg" alt="MetaCPAN" />
                </a>
              </div>
              <a class="footer-social-link" href="https://github.com/metacpan">
                <i class="fab fa-github-square"></i>
              </a>
              <a class="footer-social-link" href="https://fosstodon.org/@metacpan">
                <i class="fab fa-mastodon"></i>
              </a>
            </div>
            <div class="footer-links">
              <div class="footer-link">
                  <a href="https://metacpan.org/about">About</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/sponsors">Sponsor</a>
              </div>
              <div class="footer-link">
                  <a href="https://grep.metacpan.org">grep::cpan</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/recent">Recent</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/faq">FAQ</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/tools">Tools</a>
              </div>
              <div class="footer-link">
                  <a href="https://fastapi.metacpan.org/">API</a>
              </div>
              <div class="footer-link">
                  <a href="https://www.perl.org/">Perl.org</a>
              </div>
            </div>
            <div class="footer-sponsors">
              <a class="footer-sponsor-link" target="_blank" href="https://www.bytemark.co.uk/" rel="noopener">
                <img class="footer-sponsor-bytemark" src="https://metacpan.org/static/images/sponsors/bytemark_logo.svg" alt="Bytemark logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.liquidweb.com/" rel="noopener">
                <img class="footer-sponsor-liquidweb" src="https://metacpan.org/static/images/sponsors/liquidweb_logo.png" alt="liquidweb logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://deriv.com/careers/" rel="noopener">
                <img class="footer-sponsor-deriv" src="https://metacpan.org/static/images/sponsors/deriv.svg" alt="Deriv logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://geocode.xyz" rel="noopener">
                <img class="footer-sponsor-geocode" src="https://metacpan.org/static/images/sponsors/geocodelogo.svg" alt="Geocode logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.fastly.com/" rel="noopener">
                <img class="footer-sponsor-fastly" src="https://metacpan.org/static/images/sponsors/fastly_logo.svg" alt="Fastly logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://opencagedata.com" rel="noopener">
                <img class="footer-sponsor-opencage" src="https://metacpan.org/static/images/sponsors/open-cage.svg" alt="OpenCage logo">
              </a>
            </div>
          </div>
        </footer>
        <div class="modal fade" tabindex="-1" role="dialog" id="metacpan_keyboard-shortcuts">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Keyboard Shortcuts</h4>
              </div>
              <div class="modal-body row">
<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Global</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>s</kbd>
        </td>
        <td>Focus search bar</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>?</kbd>
        </td>
        <td>Bring up this help dialog</td>
      </tr>
    </tbody>
  </table>

  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>GitHub</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>p</kbd>
        </td>
        <td>Go to pull requests</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>go to github issues (only if github is preferred repository)</td>
      </tr>
    </tbody>
  </table>
</div>

<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>POD</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>a</kbd>
        </td>
        <td>Go to author</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>c</kbd>
        </td>
        <td>Go to changes</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>Go to issues</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>d</kbd>
        </td>
        <td>Go to dist</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>r</kbd>
        </td>
        <td>Go to repository/SCM</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>s</kbd>
        </td>
        <td>Go to source</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>b</kbd>
        </td>
        <td>Go to file browse</td>
      </tr>

    </tbody>
  </table>
</div>

<div class="col-md-12">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Search terms</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><em>module:</em> (e.g. <a href="https://metacpan.org/search?q=module%3APlugin">module:Plugin</a>)</td>
      </tr>
      <tr>
        <td><em>distribution:</em> (e.g. <a href="https://metacpan.org/search?q=distribution%3ADancer+auth">distribution:Dancer auth</a>)</td>
      </tr>
      <tr>
        <td><em>author:</em> (e.g. <a href="https://metacpan.org/search?q=author%3ASONGMU+Redis">author:SONGMU Redis</a>)</td>
      </tr>
      <tr>
        <td><em>version:</em> (e.g. <a href="https://metacpan.org/search?q=version%3A1.00">version:1.00</a>)</td>
      </tr>
    </tbody>
  </table>
</div>
              </div>
              <div class="modal-footer"></div>
            </div>
          </div>
        </div>
    </body>
</html>
